var _n58;
var cc__extends = __extends;
var cc__decorate = __decorate;
var cc__importDefault = __importDefault;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var $zqcc_OverallSystem = require("zqcc_OverallSystem");
var $gameMode_Json = require("gameMode_Json");
var $1$zqcc_pageBase = require("zqcc_pageBase");
var l = cc__importDefault($1$zqcc_pageBase);
var cc__decorator = cc._decorator;
var ccp_ccclass = cc__decorator.ccclass;
var ccp_property = cc__decorator.property;
var def_gameSettingPage = function (t) {
  function _ctor() {
    var e = null !== t && t.apply(this, arguments) || this;
    e.pageName = "游戏设置";
    e.btnMusic = null;
    e.btnSound = null;
    e.btnVibration = null;
    e.BtnNode = null;
    e.pathBtn = null;
    e.number = 0;
    e.mode = $gameMode_Json.GAME_MODE.None;
    return e;
  }
  cc__extends(_ctor, t);
  _ctor.prototype.onLoad = function () { };
  _ctor.prototype.gm = function () {
    this.number++; // 增加计数

    // 检查是否开启GM模式
    if (this.number > 20) {
      window["GM-mode"] = true; // 开启GM模式
      this.pathBtn.active = true; // 显示路径按钮
      $zqcc_OverallSystem.sers().uiSrv.showMessage("GM模式已开启"); // 提示用户
    }

    // 检查是否清除数据
    if (this.number > 30) {
      localStorage.clear(); // 清除本地存储
      seeg.setUserData({ level: 0 }); // 重置用户数据
      $zqcc_OverallSystem.sers().uiSrv.showMessage("清除数据成功"); // 提示用户
    }
  };
  _ctor.prototype.start = function () {
    // 初始化
    this._init();
    this.pathBtn.active = false; // 初始化时设置路径按钮不可见

    // 根据条件控制路径按钮的可见性
    if (window["GM-mode"] || (!window.tt && !window.wx)) {
      this.pathBtn.active = true; // 如果满足条件，则显示路径按钮
    }
  };
  _ctor.prototype.setCloseDoFun = function (t) {
    this.colseDoFun = t;
  };
  _ctor.prototype._init = function () {
    this.updateSoundBan();
    this.updateMusicBan();
    this.updateVibration();
    this.open();
  };
  _ctor.prototype.showBtn = function (t) {
    // 根据当前游戏模式设置按钮节点的可见性
    this.BtnNode.active = t !== $gameMode_Json.GAME_MODE.None; // 激活按钮节点，如果模式不是 None
    this.mode = t; // 更新当前模式
  };
  _ctor.prototype.OnBtnSound = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    $zqcc_OverallSystem.mgrs().soundMgr.enableSound(!$zqcc_OverallSystem.mgrs().soundMgr.isEnableSound);
    this.updateSoundBan();
  };
  _ctor.prototype.OnBtnMusic = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    $zqcc_OverallSystem.mgrs().soundMgr.enableAudio(!$zqcc_OverallSystem.mgrs().soundMgr.isEnableAudio);
    this.updateMusicBan();
  };
  _ctor.prototype.OnBtnVibration = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    $zqcc_OverallSystem.mgrs().soundMgr.enableVibration(!$zqcc_OverallSystem.mgrs().soundMgr.isVibration);
    console.log($zqcc_OverallSystem.mgrs().soundMgr.isVibration);
    this.updateVibration();
  };
  _ctor.prototype.Toggle = function (t) {
    // 获取用户设置数据
    const settingData = $zqcc_OverallSystem.sers().userSrv.getSettingData();

    // 更新特定索引的设置值
    settingData[5] = +t.node.name; // 将节点名称转换为数字并赋值

    // 保存更新后的设置数据
    $zqcc_OverallSystem.sers().userSrv.setSettingData(settingData);
  };
  _ctor.prototype.updateSoundBan = function () {
    this.btnSound.getChildByName("ban").active = !$zqcc_OverallSystem.mgrs().soundMgr.isEnableSound;
    this.btnSound.getChildByName("kai").active = $zqcc_OverallSystem.mgrs().soundMgr.isEnableSound;
  };
  _ctor.prototype.updateMusicBan = function () {
    this.btnMusic.getChildByName("ban").active = !$zqcc_OverallSystem.mgrs().soundMgr.isEnableAudio;
    this.btnMusic.getChildByName("kai").active = $zqcc_OverallSystem.mgrs().soundMgr.isEnableAudio;
  };
  _ctor.prototype.updateVibration = function () {
    this.btnVibration.getChildByName("ban").active = !$zqcc_OverallSystem.mgrs().soundMgr.isVibration;
    this.btnVibration.getChildByName("kai").active = $zqcc_OverallSystem.mgrs().soundMgr.isVibration;
  };
  _ctor.prototype.OnBtnBackIndex = function () {
    $zqcc_OverallSystem.sers().platformSrv.platformApi.hideBanner();
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    $zqcc_OverallSystem.mgrs().gameMgr.backHomePage();
    this.OnBtnClose();
  };
  _ctor.prototype.closePage = function () {
    this.OnBtnClose();
    $zqcc_OverallSystem.sers().platformSrv.platformApi.FullScreenVideoAd();
  };
  _ctor.prototype.replayGame = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    $zqcc_OverallSystem.mgrs().gameMgr.enterMode(this.mode, true);
    this.closePage();
  };
  _ctor.prototype.goIndex = function () {
    $zqcc_OverallSystem.mgrs().soundMgr.playBtnSound();
    $zqcc_OverallSystem.mgrs().gameMgr.backHomePage();
  };
  _ctor.prototype.showPath = function () {
    $zqcc_OverallSystem.sers().uiSrv.showPathTips();
  };
  cc__decorate([ccp_property({
    type: cc.Node,
    displayName: "背景音按钮"
  })], _ctor.prototype, "btnMusic", undefined);
  cc__decorate([ccp_property({
    type: cc.Node,
    displayName: "音效按钮"
  })], _ctor.prototype, "btnSound", undefined);
  cc__decorate([ccp_property({
    type: cc.Node,
    displayName: "震动按钮"
  })], _ctor.prototype, "btnVibration", undefined);
  cc__decorate([ccp_property(cc.Node)], _ctor.prototype, "BtnNode", undefined);
  cc__decorate([ccp_property(cc.Node)], _ctor.prototype, "pathBtn", undefined);
  return cc__decorate([ccp_ccclass], _ctor);
}(l.default);
exports.default = def_gameSettingPage;